package com.hexiang.web;

import java.util.HashMap;
import java.util.Map;

import com.hexiang.filter.RouteRuleFilter;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/groovy/script")
public class GroovyScriptController {

    @RequestMapping(value = "/execute", method = RequestMethod.GET)
    public Object execute(@RequestParam(defaultValue = "seller") String field) {
        RouteRuleFilter routeRuleFilter = new RouteRuleFilter();
        Map<String, Object> input = new HashMap<>();
        input.put("field", field);
        Map<String, Object> output = routeRuleFilter.filter(input);
        return output;
    }
}
